
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="__PUBLIC__/favicon.ico" >
<LINK rel="Shortcut Icon" href="__PUBLIC__/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="__PUBLIC__/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/static/h-ui.admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/laydate/laydate.js"></script>
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>建档</title>
</head>
<body>

<form class="form form-horizontal registerform" action="" id="form-mortgage-add" method="post">
<table class="table table-border table-bordered table-bg jd" style="width:95%; margin:20px auto;">
  <!--建档-->
  <tr>
    <td>产品类型</td>
    <td>
       
       <div class="user-sex"> 
       <ul>
        <li class="sex"><input name="doc_type" value="1" type="radio" /><label for="sex-man">急下款</label></li>
        <li class="sex"><input name="doc_type" value="2" type="radio" /><label for="sex-man">快易贷</label></li>
        <li class="sex"><input name="doc_type" value="3" type="radio" /><label for="sex-man">尾款垫资</label></li>
        <li class="sex"><input name="doc_type" value="4" type="radio" /><label for="sex-man">赎楼解押</label></li>
        <li class="sex"><input name="doc_type" value="5" type="radio" /><label for="sex-man">直通车</label></li>
        <li class="sex"><input name="doc_type" value="6" type="radio" /><label for="sex-man">易审通</label></li>
        <li>需要天数：<input name="needday" value="{$documentlist['need_day']}" type="text" class="input-text kk" style=" width:80px;"/>&nbsp;天</li>
        </ul>
        <div>
    </td>
  </tr>
  <tr>

    <td width="120">买方信息</td>
    <td>
    <ul>
    <li> 姓名<input type="text" name="buy_name" id="buy_name" value="" class="input-text kk" style=" width:120px" required='true'></li>
    <li>身份证号<input datatype="idcard" nullmsg="请填写身份证号码！" errormsg="您填写的身份证号码不对！"  type="text" name="buy_card" id="buy_card"  value="" class="input-text kk" style=" width:180px;" required='true'></li>
    <li><div class="Validform_checktip"></div></li>
    <li>建档时间<input class="input-text kk" onClick="laydate()" name="create_time" style=" width:100px;margin-right:140px;" required='true'  value="<?php echo date("Y-m-d"); ?>"></li>
    <li>单位性质<input type="text" name="nature" id="nature"  value="" class="input-text kk" style=" width:180px;" required='true'></li>
    <li>手机号码<input type="text" name="buy_phone" id="buy_phone"  value="" class="input-text kk mobile" style=" width:120px" required='true' datatype="mobile"  errormsg="手机号码格式不对！"></li>
    <li  style="height:33px"><div class="Validform_checktip"></div></li>
    <li>家庭电话<input type="text" name="buy_tel" id="buy_tel"   value="" class="input-text kk" style=" width:120px" required='true'></li>
    <li>工作单位<input type="text" name="buy_work" id="buy_work"  value="" class="input-text kk" style=" width:240px;" required='true'></li>
    <li>单位电话<input type="text" name="buy_work_tel" id="buy_work_tel"  value="" class="input-text kk" style=" width:120px" required='true'></li>
    </ul>
    </td>
  </tr>
  <tr>
    <td>买方配偶信息</td>
    <td>
    <ul>
    <li>姓名<input type="text" name="buy_spouse_name" id="buy_spouse_name"  value="" class="input-text kk" style=" width:120px" ></li>
    <li>身份证号<input  datatype="idcard" errormsg="您填写的身份证号码不对！" ignore="ignore"  type="text" name="spouse_card" id="spouse_card"  value="" class="input-text kk" style=" width:180px" ></li>
    <li style="height:33px"><div class="Validform_checktip"></div></li>
    <li>手机号码<input datatype="mobile" ignore="ignore" type="text" name="buy_spouse_tel" id="buy_spouse_tel"  value="" class="input-text kk mobile" style=" width:120px"></li>
    <li><div class="Validform_checktip"></div></li>
    </ul>
    </td>
  </tr>
  <tr>
    <td>卖方信息</td>
    <td>
     <ul>
    <li>姓名<input type="text" name="sell_name" id="sell_name"  value="" class="input-text kk" style=" width:120px" required='true'></li>
    <li>手机号码<input type="text" name="sell_phone" id="sell_phone"  value="" class="input-text kk mobile" style=" width:180px" required='true' datatype="mobile" errormsg="手机号码格式不对！"></li>
    <li><div class="Validform_checktip"></div></li>
    <li> 家庭电话<input type="text" name="sell_tel" id="sell_tel"  value="" class="input-text kk" style=" width:120px" required='true'></li>
    </ul>
    </td>
  </tr>
  <tr>
    <td>贷款信息</td>
    <td>
    <ul>
    <li>公积金<input required='true' name="account_type" type="radio" value="1" checked class="kk">省行
      <input  name="account_type" type="radio" value="2" checked class="kk">市行
      <input required='true' type="text" name="account_amount" id="account_amount"  value="0" class="input-text kk one" style=" width:100px">万元<span class="fonnt01">（如有公积金，请选择公积金类型）</span></li>
    <li>商业<input required='true' type="text" name="business_amount" id="business_amount"  value="0" class="input-text kk two" style=" width:100px">万元</li>
    <li>贷款总金额<input required='true' type="text" name="total_amount" id="total_amount"  value="" class="input-text kk three" style=" width:100px" readonly>万元</li>
    <li>贷款年限<input required='true' type="text" name="loan_year" id="loan_year"  value="" class="input-text kk" style=" width:100px">年</li>
    </ul>
    <ul>
    <li>贷款银行<select name="bank_id" class="select2 kk" required='true'>
      <option value="">请选择</option>
      <volist name="banks" id="banks" >
      <option value="{$banks.bank_id}">{$banks.bank_name}</option>
      </volist>
    </select></li>
     <li>备注<input type="text" name="loan_remark" id="loan_remark"  value="" class="input-text kk" style=" width:500px" ></li>
    </ul>
     <ul>
    <li>监管类型
    <input name="supervise" type="radio" value="1" class="kk">贷款监管
    <input name="supervise" type="radio" value="2" class="kk">全款监管
    <input name="supervise" type="radio" checked value="3" class="kk">不监管
    </li>
    </ul>
    </td>
  </tr>
  <tr>
    <td>房屋信息</td>
    <td>
    <ul>
    <li>地址<input required='true' type="text" name="address" id="address"  value="" class="input-text kk" style=" width:280px"></li>
    <li>区域：<input required='true'  name="area" value="1" type="radio"/>市区<input name="area" value="2" type="radio"/>江宁<input name="area" value="3" type="radio"/>江北</li>
    <li>面积<input required='true' type="text" name="house_area" id="house_area"  value="" class="input-text kk" style=" width:100px">平方米</li>
    <li>建筑年代<input required='true' type="text" name="house_age" id="house_age"  value="" class="input-text kk" style=" width:100px">年</li>
    <li>房屋总价<input required='true' type="text" name="house_total" id="house_total"  value="" class="input-text kk" style=" width:100px">万元</li>
    </ul>
    </td>
  </tr>
  <tr>
    <td>中介公司</td>
    <td>
    <ul>
    <li>公司名称
    <input required='true' name="agent" type="text" value="" class="input-text kk" style=" width:220px" />
    </li>
    <li>门店
    <input required='true' name="agentAddress" type="text" value="" class="input-text kk" style=" width:220px" />
    </li>
    <li>中介经办人<input required='true' type="text" name="agent_name" id="agent_name"  value="" class="input-text kk" style=" width:120px"></li>
    <li>联系电话<input datatype="mobile" errormsg="手机号码格式不对！" required='true' type="text" name="agent_tel" id="agent_tel"  value="" class="input-text kk" style=" width:120px"></li>
    <li><div class="Validform_checktip"></div></li>
    </ul>
    </td>
  </tr>
  <tr>
    <td>营销人员</td>
    <td>
    <ul>
    <li>营销人<select name="market_id" class="select2 kk" style="width:200px" required='true'>
        <option value="">请选择</option>
      <volist name="marketlist" id="marketlist" >
      <option value="{$marketlist.user_id}">{$marketlist.user_name}</option>
      </volist>
      <option value="127">王玲</option>
      <option value="92">丁琛</option>
    </select>
  </li>
    <li>签单人<input required='true' type="text" value="{$user_auth.username}" class="input-text kk" style=" width:200px" disabled="true"><input type="hidden" name="sign_id" id="sign_id"  value="{$user_auth.userid}"></li>
    </ul>
    </td>
  </tr>

  <tr>
  <td colspan="2" align="center" style="text-align:center"><input type="submit" value="保存"  class="btn btn-danger radius"></td>
  </tr>

 </table>
</form>



<script type="text/javascript" src="__PUBLIC__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/Validform/5.3.2/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/h-ui.admin/js/H-ui.admin.js"></script>

<script>
var index = parent.layer.getFrameIndex(window.name)
var res = 0;
var res1 =0;
	$(".registerform").Validform({
		tiptype:2,
		datatype:{
		    "mobile":function(o,t){
                var regMobile=/^1[3,5,7,8]\d{9}$/;
                if(regMobile.test(o)){
                  res1 = 1;
                 return true;
                }
                res1 = 0;
                 return false;
            },
			"idcard":function(gets,obj,curform,datatype){
				//该方法由佚名网友提供;

				var Wi = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1 ];// 加权因子;
				var ValideCode = [ 1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2 ];// 身份证验证位值，10代表X;

				if (gets.length == 15) {
					return isValidityBrithBy15IdCard(gets);
				}
                else if (gets.length == 18){
					var a_idCard = gets.split("");// 得到身份证数组
					if (isValidityBrithBy18IdCard(gets)&&isTrueValidateCodeBy18IdCard(a_idCard)) {
					    res =1;
						return true;
					}
					res =0 ;
					return false;
				}
				else if(gets.length == 8 || gets.length == 9||gets.length == 10){
                  if(checknumber(gets)){
                      res=1;
                    return true;
                  }
                  else{
                      res=0;
                    return false;
                  }
                }
                res=0;
                return false;

				function isTrueValidateCodeBy18IdCard(a_idCard) {
					var sum = 0; // 声明加权求和变量
					if (a_idCard[17].toLowerCase() == 'x') {
						a_idCard[17] = 10;// 将最后位为x的验证码替换为10方便后续操作
					}
					for ( var i = 0; i < 17; i++) {
						sum += Wi[i] * a_idCard[i];// 加权求和
					}
					valCodePosition = sum % 11;// 得到验证码所位置
					if (a_idCard[17] == ValideCode[valCodePosition]) {
						return true;
					}
					return false;
				}

				function isValidityBrithBy18IdCard(idCard18){
					var year = idCard18.substring(6,10);
					var month = idCard18.substring(10,12);
					var day = idCard18.substring(12,14);
					var temp_date = new Date(year,parseFloat(month)-1,parseFloat(day));
					// 这里用getFullYear()获取年份，避免千年虫问题
					if(temp_date.getFullYear()!=parseFloat(year) || temp_date.getMonth()!=parseFloat(month)-1 || temp_date.getDate()!=parseFloat(day)){
						return false;
					}
					return true;
				}

				function isValidityBrithBy15IdCard(idCard15){
					var year =  idCard15.substring(6,8);
					var month = idCard15.substring(8,10);
					var day = idCard15.substring(10,12);
					var temp_date = new Date(year,parseFloat(month)-1,parseFloat(day));
					// 对于老身份证中的你年龄则不需考虑千年虫问题而使用getYear()方法
					if(temp_date.getYear()!=parseFloat(year) || temp_date.getMonth()!=parseFloat(month)-1 || temp_date.getDate()!=parseFloat(day)){
						return false;
					}
					return true;
				}

				function checknumber(number){
                  var str=number;
                  //在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
                  var Expression=/^(1[45][0-9]{7})|G[0-9]{8}|P[0-9]{7}|S[0-9]{7,8}|D[0-9]{8}$/;
                  var objExp=new RegExp(Expression);
                  if(objExp.test(str)==true){
                     return true;
                  }else{
                     return false;
                  }
                };


			}

		}
	});

$("#form-mortgage-add").submit(function(){

    if(res!=1 || res1!=1){
    layer.msg('请正确填写');
    return false;
  }
$(".radius").attr('type','button');
        $.ajax({
          url:'{:U("Index/creatmortgage")}',
          type:'post',
          data:$('#form-mortgage-add').serialize(),
          dataType:'json',
          success:function(data){
            if(data.ResultCode == '200'){
              layer.msg(data.ResultMessage,{time:1000},function(){
                  parent.window.location.reload()
                  parent.layer.close(index);
              });
            }
            else if(data.ResultCode == '500'){
                layer.msg(data.ResultMessage,{time:1000},function(){

                })
            }
          }
        })
        return false;
	});
    $('.one').blur(function(){
        if($(this).val()){
            if($('.two').val()){
                $('.three').val(parseFloat($(this).val()) + parseFloat($('.two').val()));
            }else{
                $('.three').val(parseFloat($(this).val()));
            }
        }else{
           $('.three').val(parseFloat($('.two').val()));
        }
    })
    $('.two').blur(function(){
        if($(this).val()){
            if($('.one').val()){
                $('.three').val(parseFloat($(this).val()) + parseFloat($('.one').val()));
            }else{
                $('.three').val(parseFloat($(this).val()));
            }
        }else{
           $('.three').val(parseFloat($('.one').val()));
        }
    })
 </script>

<link href="__PUBLIC__/dxk/icheck.css" rel="stylesheet">
<script src="__PUBLIC__/dxk/icheck.js?v=1.0.2"></script>
              
                <script>
                    $(document).ready(function(){
                        $('.user-sex input').each(function(){
                            var self = $(this),
                                    label = self.next(),
                                    label_text = label.text();

                            label.remove();
                            self.iCheck({
                                checkboxClass: 'icheckbox_sm-blue',
                                radioClass: 'radio_sm-blue',
                                insert: label_text
                            });
                        });
                    });
                </script>
</body>
</html>
